import wx
APP_EXIT = 1
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
        self.InitUI()
    def InitUI(self):
        menubar = wx.MenuBar()
        fileMenu = wx.Menu()

        qmi = wx.MenuItem(fileMenu, APP_EXIT, '&Quit\tCtrl+Q')
        # qmi.SetBitmap(wx.Bitmap('exit.png'))
        fileMenu.Append(qmi)

        menubar.Append(fileMenu, '&File')
        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.OnQuit, id=APP_EXIT)
        self.SetSize((300,200))
        self.Center()
    def OnQuit(self, e):
        self.Close()
def main():
    app = wx.App()
    frame = Example(None, title='子菜单演示')
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
